In [8]:
%run Preparation.ipynb
In [9]:
rmdf152 = pd.read_csv("data/2017-06-28.fes-a.csv")
relevantColumns = ['id', 'playerId', 'serverTime', 'customData.localplayerguid', 'customData.platform']
part152 = rmdf152.loc[:,relevantColumns]
df = part152
In [12]:
startTime = "2017-06-08T09:30:00.000Z"
endTime = "2017-06-10T19:10:00.000Z"
duringFESDf = rmdf152[(rmdf152['serverTime'] > startTime) & (rmdf152['serverTime'] < endTime)]
duringFESDf = duringFESDf.loc[:,relevantColumns]
sessionscount = duringFESDf["playerId"].nunique()
sessionscount
Out[12]:
In [13]:
#players = duringFESDf['customData.localplayerguid', 'customData.platform'].dropna(how='any').unique()
#players = duringFESDf.loc[:,['customData.localplayerguid', 'customData.platform']].dropna(how='any').unique()
players = duringFESDf.loc[:,['customData.localplayerguid', 'customData.platform']]
players = players.dropna(how='any')
#players = players.unique()
players
Out[13]:
In [14]:
playerscount = players.nunique()
playerscount
In [ ]:
In [ ]:
#arcadeDf = df[customData.localplayerguid] == arcadeCabinetID;
Number of unique game sessions
In [ ]:
playerscount = df["playerId"].nunique()
playerscount
Number of unique devices ids
In [ ]:
localPlayerGuids = df.loc[:,['playerId', 'customData.localplayerguid']]
localPlayerGuids.columns= ['id', 'guid']
localPlayerGuids = localPlayerGuids[localPlayerGuids['guid'].notnull()]
localPlayerGuids = localPlayerGuids['guid']
localPlayerGuids.nunique()
localPlayerGuids.unique()
Duration of playing sessions
In [ ]:
durations = df.groupby("playerId").agg({ "serverTime": [ np.min, np.max ] })
durations["duration"] = pd.to_datetime(durations["serverTime"]["amax"]) - pd.to_datetime(durations["serverTime"]["amin"])
durations["duration"] = durations["duration"].map(lambda x: np.timedelta64(x, 's'))
durations = durations.sort_values(by=['duration'], ascending=[False])
durations.head()
Duration plot
In [ ]:
durations.loc[:,'duration']
durations = durations[4:]
durations["duration_seconds"] = durations["duration"].map(lambda x: pd.Timedelta(x).seconds)
maxDuration = np.max(durations["duration_seconds"])
durations["duration_rank"] = durations["duration_seconds"].rank(ascending=False)
durations.plot(x="duration_rank", y="duration_seconds")
plt.xlabel("game session")
plt.ylabel("time played (s)")
plt.legend('')
plt.xlim(0, playerscount)
plt.ylim(0, maxDuration)
durations["duration_seconds"].describe()
durations.head()